
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 0801
 * @Author : WangRuoyu 
 * @Date : 2023/9/15 16:54
 */

#include "iostream"

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    while (n--) {
        int k;
        int s = 0;
        scanf("%d", &k);
        while (k) {
            k -= (k & -k);
            s++;
        }
        printf("%d ", s);
    }
    return 0;
}